Is head used to mean the same thing in the next two sentences?

I couldn't get his words out of my head.

This song keeps going through my head.
the same meaning