A dog may interpret looking directly into their eyes too much as threatening. When you look away it is a sign that you are submissive and not a potential danger to them. If you are viewed as a danger they could act against you out of fear.
This applies more to dogs you have never met, but always best to be careful. Dogs have been bred for many 1000's of years to be what they are today, which is kind and wanting our attention. It is not always the case, but really part of their nature these days.