Yes, if you can convince the HP to behave like an overhead projector.
The Mac will gladly send it whatever signal it needs: VGA, HDMI, DIV-X, whatever. Just need to purchase the appropriate Thunderbolt adapter and cable.
The other way around? No. The Mac will not deign to be reduced to a life of "backup monitor".
To my knowledge there is no notebook by any manufacturer running any OS, Mac or Windows, that can be used as just a external screen for any other notebook or any computer. There is no InPut for just the screen. All ports on all notebooks, at least for Video, are only for outputing the Video signal to connect to a stand alone screen.