You can, but you can just play more solid as well, without sacrificing anything. You can simply develop with 2.Nc3.
And black is at least equal, which is always great as black after a few moves. But yeah, you can play it as a pawn sacrifice, I wouldn't do it as a beginner, this is more clear cut as the material is still equal and that is easier to understand.
The second example looks like a big mess to me, black doesn't have castling rights etc. It might be ok, but I wouldn't like to have that position as black. I would probably play Nf6 after early Bc4, and there wouldn't be Qh5 business. It seems simpler to me.
One of the most common Opening that lower rated players will have to defend against is the Wayward Queen Attack. When I first started playing online chess I had some difficulty against the Wayward Queen Attack, therefor I looked for a solution on line and in books. John Emms has a recommended defense but I did not like the resulting position. To me it seemed like White had gotten away with defining opening principles. I then got out my board and worked out a defense. I am sure that many others have played the same moves. My idea was to play a gambit defense and to attack the queen as often as possible.
In gambit play 1 pawn is worth 1 move of development, therefore Black has compensation for the pawn. Furthermore depending on White's next move there are additional attacks against the queen it is even possible that the queen will be come trapped.
There are other forms of the Wayward Queen Attack, most of which involve placing the bishop on c4 before advancing the Queen to h5. It may interest some to know that chess books of the late 1800 included 1. e4, e5 2. Bc4, Bc5 and then 3. Qf3, or Qg4, or Qh5 not as recommended lines but as lines to know how to defend against. The Qh5 line is the one most seen these days by bingers the recommended line is as follows: