You can suppose $X$ and $Y$ are Banach spaces, by taking their completions and extending $A,A^{-1},B,B^{-1}$ to them (since the extensions of $A$ and $A^{-1}$ are inverses of one another on dense subspaces, they will also be inverses of one another).
Then first consider the case when $X=Y$ and $A=I$, the identify operator. In this case $\Vert B-I\Vert\leq 1/2$, so the inverse of $B$ is given by $B^{-1}=\sum_{n=0}^\infty(I-B)^n$ (this is where we use completeness of $X$). Then show the result in this case:
$$\Vert B^{-1}-I\Vert\leq 2\Vert B-I\Vert$$
Now in the general case, from $\Vert B-A\Vert\leq(1/2)\Vert A^{-1}\Vert$ we obtain $\Vert BA^{-1}-I\Vert\leq 1/2$. Use the previous case with $BA^{-1}$ in place of $B$ and obtain
$$\Vert(BA^{-1})^{-1}-I\Vert\leq 2\Vert BA^{-1}-I\Vert$$
which you can show to imply $\Vert B^{-1}-A^{-1}\Vert\leq 2\Vert A^{-1}\Vert^2\Vert B-A\Vert$
For the case $A=I$: Using $B^{-1}=\sum_{n=0}^\infty (I-B)^n$,
\begin{align*}
\Vert B^{-1}-I\Vert&=\Vert\sum_{i=1}^\infty(I-B)^n\Vert\leq\sum_{i=1}^n\Vert I-B\Vert^n=\Vert I-B\Vert\sum_{i=0}^\infty\Vert I-B\Vert^n\\
&\leq\Vert I-B\Vert\sum_{i=0}^\infty 2^{-n}=2\Vert I-B\Vert
\end{align*}