Let investigate the first derivative f '(x).
f(x) is decreasing at x = -5, so (a) f '(-5) < 0
f(x) has a local minimum at x = -2, so (b) f '(-2) = 0 and f '(x) changes from negative to positive at x = -2.
f(x) has a local maximum at x = 2, so (c) f '(2) = 0 and f '(x) changes from positive to negative at x = 2.
Generate a continuous function f '(x) which has the properties (a), (b), and (c).
The easiest such function is the parabola 4 - x2
So, we can take f '(x) = 4 - x2
Take the antiderivative: f(x) = 4x - x3/3