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

The beer had a large head of foam.

The head of the compass needle is pointing due north.
different meanings