Only the second diagram represents a function.
In fact, a function must associate one and only one output with every input in the domain.
The first diagram associates four different outputs to the same input, and thus it's not a function.
The second diagram associate one and only one output to each input. The fact that this output is always the same does not matter.
In other words, you have to make sure that only one arrow starts from every point on the domain. There is no problem is more than one arrow lands on the same element in the codomain.