''I have a headache'' would be "atama ga itaï" (zutsuu ga aru in medical term)
''I'm unhappy'' would be "ureshikunaï, sabishii", but I have not really heard
"atama ga itaï" to express unhappiness ...
Another way to put this is "mukatsuku" lit. I am disgusted (I feel like vomiting), which could be linked to a headache ...
In Japanese, atama-ga itai (''I have a headache'') is used to express that you are having a problem that makes your head hurt or worrying about something.
Being unhappy can be expressed by many idioms. Aoyama has undertaken to provide several. Here are my suggestions.
...-ga tanoshiku nai. [... does not please one]
gakkō-ga tanoshiku nai.
I am unhappy at schoo.
patto shinai. [things are not bright/mundane]
saikin patto shinai.
I am unhappy lately.