When I hear someone say "$y$ is a function of $x$," I think of the notation $y(x) = 2x + 4$. But I've seen some people also say that $y = 2x + 4$ is a function $y$ of $x$. That's confusing to me because surely that's an equation and not a function. You can change it to be $x = \frac{1}{2}y - 2$, can you now call it $x$ being a function of $y$ even though nothing changed except for where the variables are or is that just outright incorrect and an equation can't be considered a function of another variable like that? I've seen these two being used interchangeably most often when plotting graphs of polynomials, sometimes the $y$-axis is even labelled $y(x)$ even though I didn't know you could have a function as an axis.
A little more broadly, how can I know when something is a function and when it is an equation, and are there any notable differences or problems when you misuse them (e.g. when a function was used when an equation should have been)?
Ultimately, I think that you are correct to write $y = f(x)$ when given the information "$y$ is a function of $x.$"
Like you mention, the equation $y(x) = 2x + 4$ implicitly gives the information that the output $y$ depends upon the input $x,$ i.e., $y$ is the dependent variable, and $x$ is the independent variable; however, it is a common abuse of notation to write $y = 2x + 4$ in place of the function $y(x) = 2x + 4.$ Unfortunately, in this case, the notation is ambiguous because as you noted, we could also write $x = \frac 1 2 y - 2,$ and this describes $x$ as a function $x(y) = \frac 1 2 y - 2$ of $y.$ What you are witnessing in this example is that the function $f(x) = 2x + 4$ has an inverse, i.e., there exists a function $g(x)$ such that $f \circ g(x) = x$ and $g \circ f(x) = x.$ Explicitly, the inverse function is $g(x) = \frac 1 2 x - 2.$ One can check that $f \circ g(x) = 2g(x) + 4 = x$ and $g \circ f(x) = \frac 1 2 f(x) - 2 = x.$
Like Maryam mentions above, the clear distinction between a function $f(x)$ and an equation is that a function comes with a domain (i.e., a set of $x$-values that are valid inputs for $f(x)$) and a codomain (i.e., a set of $y$-values that are valid outputs for $f(x)$). Unfortunately, in the case of $f(x) = 2x + 4,$ all $x$-values are valid inputs, and all $y$-values are valid outputs, so the domain and codomain are often suppressed; however, for the function $g(x) = \sqrt x,$ the domain and the codomain are quite important because the square root of a negative number is not a real number, hence the equation $y = \sqrt x$ is rather meaningless.