The differences (seem to) alternate between $2$ and $3$. That means the odd and even positions each form an arithmetic progression with difference $5$.
That should be enough information for you to reconstruct the `convert` function. There's no really clean "formula".
**Edit** in answer to comments. The following algorithm correctly makes the calculation based on the previous observation, but that observation does not match the data. The comments explain what's going on.
The output number $y$ will always leave a remainder $r$ of $1$ or $4$ when you divide it by $5$. To recover the input $x$:
Let $$ z = \frac{(y-r)}{5}. $$ Then $$ x = \begin{cases} 2z & \text{ if } r = 1 \\\ 2z+ 1 & \text{ if } r = 4 . \end{cases} $$