They're both correct in html5, html now allows block elements in inline elements.
Because of this, it's not a choice of validness, but a preference in User Interface.
If you wrap the header around the anchor, you will create a large anchor, only the text will be clickable.
When you wrap the header around the header, the whole line get's clickable.