In fact, the two definitions you show are the same.
We assume that $f:\mathbb{R}\to\mathbb{R}$ is measurable. Let $A=\{\sup f(S): S\subset \mathbb{R} \mbox{ measurable}, \mu(S^c)=0\}$ and $B=\{a: \mu(\{x: f(x)>a\})=0\}$.
Claim: $\inf A =\inf B$.
Proof: Suppose $p\in A$ and $p=\sup f(S)$ for some measurable set $S$ such that $\mu(S^c)=0$. Then $\{x: f(x)>p\}\subset S^c$, so
$\mu(\{x: f(x)>p\})=0$ and $p\in B$. Thus $A\subset B$ and $\inf A\ge \inf B$.
On the other hand, suppose $a\in B$. Then $\mu(\{x: f(x)>a\})=0$ so the set $S=\{x: f(x)\le a\}$ is one of the defining subset in the definition of $A$. Clearly $\sup f(S)\le a$. This proves that $\inf A\le \inf B$.
The proof for the essential inf is similar.
I'm interpreting the question as asking to prove that given an ordered field $\mathbb F$, if $\mathbb F$ has the lub property, then $\mathbb F$ has the glb property. Or equivalentely that if all non-empty bounded above subsets of $\mathbb F$ have a supremum, then all non-empty and bounded below subsets of $\mathbb F$ have an infimum.
Ordered fields are irrelevant here, this can be generalized to any poset.
Let $P$ be a poset such that each of its non-empty and bounded above subsets has a supremum.
The goal is to prove that any non-empty and bounded below subset $A$ of $P$ has an infimum.
Being a universal statement, one way to prove it is to start by taking an arbitrary non-empty and bounded below subset $A$ of $P$.
Now consider the set $\downarrow A$, where $\downarrow A:=\{p\in P\colon \forall a\in A(p\leq a)\}$, that is, consider the set the lower bounds of $A$.
The set $\downarrow A$ isn't empty because $A$ is bounded below. It is also bounded above by any element of $A$.
Hence it's possible to use the hypothesis that any non-empty and bounded above subset of $P$ has a supremum particularized to $\downarrow A$.
Let $s:=\sup\left(\downarrow A\right)$.
Claim: $s=\inf(A)$.
Proof: It suffices to prove that $s$ is a lower bound of $A$ and that $\forall p\in \downarrow A(p\leq s)$. The latter part follows immediately from the fact that $s$ is an upper bound of $\downarrow A$. The first part follows from the fact that any element of $A$ is an upperbound of $\downarrow A$ and hence greater than the supremum of $\downarrow A$ which is $s$.
Since $A$ was an arbitrary bounded below and non-empty subset of $P$, it wasproved that $P$ has the glp property.
Best Answer
The fact that they are not empty is a consequence of the Archimedean property, rather than of the denseness of the rationals (it would be hard to use the denseness of the rationals to establish that both $A$ and $B$ are nonempty for $x\in\mathbb{Q}$, for example...)
Note that since every element of $A$ is a lower bound for $B$, then $a\leq\mathrm{inf}(B)$ for all $a\in A$; therefore, $\mathrm{inf}(B)$ is an upper bound for $A$, so $\mathrm{sup}(A)\leq\mathrm{inf}(B)$. So you only need to show that they are equal.
Moreover, it is easy to check that $\mathrm{sup}(A)\leq x\leq \mathrm{inf}(B)$.
If you want to proceed by contradiction, one possible way would be to assume that $\mathrm{sup}(A)\lt\mathrm{inf}(B)$. In that case, at least one of $\mathrm{sup}(A)$ and $\mathrm{inf}(B)$ is not equal to $x$. Say $\mathrm{sup}(A)\neq x$; then $\mathrm{sup}(A)\lt x$. Can you come up with some $q\in\mathbb{Q}$ that would satisfy $\mathrm{sup}(A)\lt q\lt x$ in that situation? Then you can try something similar under the assumption that $x\lt \mathrm{inf}(B)$.