"We still didn't know if the dogs ... can somehow understand that, say, a happy facial expression is positive and a negative facial expression is negative," says study leader Natalia de Souza Albuquerque, a Ph.D. student in experimental psychology at the University of São Paulo in Brazil.

For the research, Albuquerque and her team recruited 17 pet dogs from around Lincoln, England, and put the canines through two rounds of experiments in their laboratory.

Doggy Trials

In the first trials, each dog was placed in front of two screens and presented with an image of a dog or human with either a happy or angry facial expression. The images were then paired with a variety of sounds—a playful or aggressive bark for dogs, and a phrase in an unfamiliar language—Brazilian Portuguese—in a happy or angry tone for people. (Read why dogs are even more like us than we thought.)

Related: This is What Your Dog Does When You're Angry

When exposed to complimentary images and sounds in both humans and dogs—say, a happy dog facial expression and playful bark—the dogs looked at the screens longer than if the facial expression did not match the sound.

Their paying attention was a clue that the dogs recognized the emotions.

On the other hand, when dogs heard a neutral sound, the animals lost interest, looking around the room instead of at the screen—an indicator that the dogs had correctly discerned a lack of emotion.

Clever Pups

According to Albuquerque, dogs' ability to connect emotionally with humans and dogs is neither an instinct or learned behavior, but rather a sign of cognitive ability.

"The dogs had to extract the information from the sound, then associate this information with the image, and that involves very complex psychological mechanisms," she says. (Read why dogs are so friendly.)

Surprisingly, the team discovered that the dogs were better at recognizing emotions of their fellow species than those of humans.

"That was quite interesting," Albuquerque says, "because it makes sense to think that dogs already have that ability [to emotionally connect] and use that, and develop that, to interact with humans."