In order to a relation be a function, each value of x in the set of points can have only one corresponding value of y in the set.
For example, a relation with the points (1, 2) and (1, 3) is not a function, because the x-value 1 has two different values of y (2 and 3), and in order to be a function, a value of x can have only one corresponding value of y.
Looking at set A, each value of x (-5, -2, 2 and 5) have only one corresponding value of y, so set A is a function.
Looking at set B, the value of x = 5 has two different values of y (-2 and 2), so this set is not a function.