Thought I'd add something more about my own two dogs. We adopted both from a shelter but one was a months old puppy while the other was about five years old. The latter dog was a skinny waif. Her ears were slicked back in fear and she shivered from anxiety. She'd been in the shelter for a while and because she wasn't young or exceptionally desirable as in breed, age or appearance, she probably would have ended up being put down.
When our younger dog (a terrier-chi mix) dreams, he yips and "runs" and generally has a playful energy to his dreaming actions. As though he is chasing a squirrel in our backyard.
When our older dog dreams, she has a muffled bark that sounds like a warning or alarm (she does sound off an alarm whenever someone comes to the front door) and she growls and whimpers, too. We adopted her first and when she was the only dog, she had separation anxiety when left at home alone. She would chew anything she could that was in the room and she would howl. Now that she isn't the only dog left behind, she no longer has the anxiety as much. She still will howl occasionally which freaks out our other dog.
Her dreams seem more anxiety-filled. Poor thing. We don't know what she went through before she landed in the shelter and she gets lots of love and loving treatment here but her dreams...they may be playing out old memories sometimes.
Guess it is the same with humans.