Does word "head" have the same meaning in the following two sentences?

He stuck his head out the window.

Be careful when you pet that dog on the head; it may bite.
the same meaning