If you want to apply that formula to any real, discrete, device, then it is not going to work, even if the datasheet mentioned K.
The fact is, that real discrete device sport a wild variation of parameters, in particular Vth. Therefore, even if you knew a fairly precise value of K, it wouldn't matter much, because in the inverse formula you would have Vth as a parameter.
Consequently, any value of Vgs you would get would be highly inaccurate, unless you measured the Vth of the specific device.
Of course if you can measure quantities on a real specimen, you would be able also to measure Vgs, so the whole point in deriving that formula might be moot. In fact, with some patience and a relatively simple circuit, you could characterize the device yourself, by measuring Id vs Vds at different Vgs levels, and plotting the output curves of the device.
To be more specific, here is an excerpt from a datasheet of a jellybean enhancement MOSFET (2N7000G; emphasis mine):
As you can see, Vth is specified with very loose tolerance, therefore you could expect the same tolerance on the values of Vgs obtained by inverting that formula.