Hi Luis, just take a step back and consider
$x$ and
$y$ as independent variables (i.e. not
$y=y(x)$). Then search for a new function
$f=f(x,y)$, the so-called potential function with the property that the total differential of
$f$ gives the differential equation back:
$\begin{equation}df=\frac{\partial f}{\partial x} dx+\frac{\partial f}{\partial y} dy = (5x+4y)dx+(4x-8y^3)dy\end{equation}=0$. To do this one solves a partial differential equation system for
$f$ in
$x$ and
$y$
In[1]:= DSolve[{D[f[x, y], x] == 5 x + 4 y, D[f[x , y], y] == 4 x - 8 y^3}, f, {x, y}]
Out[1]= {{f -> Function[{x, y}, (5 x^2)/2 + 4 x y - 2 y^4 + C[1]]}}
which gives clearly your lecturer's solution.
The constant C[1] does not matter, because it disappears under the total differential of
$f$.