The only way to find out would be to the question of a dog...
We (or at any rate I...) have trouble enough understanding the minds of other humans when they are standing there telling us what they think and feel -- what chance have we with dogs?
Think how it is with baby humans, which do at least have the same construction as the rest of us. It can be difficult enough establishing why one's little treasure is crying, even when they have some language: "It hurts!" "Where" "Don't know" ... etc.
Headaches in humans are not well understood either, so I doubt if there's much chance of understanding them in dogs or other non-speaking animals. For a start, there are many different kinds of headache.