A linear function in slope intercept form is
y = mx + c
To find the equation, you need m and c. This can be found by substituting the points you have.
For example, 5 = -1(m) + c and -7 = 2(m) + c
From here, do simultaneous equations
c = m + 5
-7 = 2(m) + m + 5
3m = -7 -5
m = -4
c = m + 5
c = 1
Rewrite the equation: (This is your answer)
y = -4x + 1