Have you ever noticed your dog following your every move with their eyes? Dogs have an innate ability to follow our gestures and our gazes. Studies have even shown that when a dog locks eyes with you it sets off a mutually reinforcing loop of oxytocin production. Oxytocin is a hormone that modulates feelings of affection.
A dog’s brain also contains anatomical features that process emotional cues in our voices. Which is why they know you’re mad when you’re yelling and happy when you talk to them like they’re a baby. They also have the ability to register the emotions on our faces. This ability is heightened by an olfactory sensitivity to human hormonal changes. When researchers presented dogs with shirts their people wore in stressful circumstances their dogs' heartbeats sped up because our distress made them distressed. This is considered a form of empathy.
You may notice that a dog in a shelter doesn’t follow human gaze or gestures, a behavior that might discourage someone from adopting them - it’s not because they’re biologically lacking in something that other dogs possess. Rather, they haven’t had the upbringing necessary to nourish their sensitivities. With care and attention they can still develop them.