What is the UX effect of input labels (NOT placeholders!) inside vs outside input wrappers?

I was wondering if there is any research or literature you know which discusses the position of an input label in regards to the input wrapper?

Take the following example:

labels outside vs inside input wrapper

Both versions take the same space.