Your book's terminology is a bit misleading. From a mathematical viewpoint, it's important to note that $B2T_w$ does not convert from a two's complement representation to a decimal representation of a number.
It simply converts from a two's complement representation of a number to the number it represents.
"2017" (in decimal notation) is neither more, nor less, a 'representation' of a particular number than "011111100001" is (in two's complement notation using $12$ bits). It's not like the number is "truly" 2017, instead of 011111100001; they are just two different names for the same abstract thing.
That being said, I think what you are asking is, given that "abstract thing" (e.g., whose name, in decimal notation, is "2017"), and given some $n$, how do we calculate what $x_{n}$ is in the $w$-bit two's complement notation for that number?
Well, we aren't going to get something particularly clean looking, but here's an approach that may satisfy via a recurrence, and is reasonably close to how one might generate the two's complement "in the usual way"...
Assume the number in question is $X$. First, $n = w-1$ is a bit of a special case:
$$x_{w-1} = \begin{array}{lr}
0 & \text{if } X\geq 0\\
1 & \text{if } X < 0
\end{array}$$
So given that, and replacing $B2T_w(x)$ with $X$ and rearranging a term, we can adjust the formula you gave as:
$$X + x_{w-1}2^{w-1} = \sum_{i=0}^{w-2}x_i 2^{i}$$
For $0 \leq n < w-1$, then
$$X + x_{w-1}2^{w-1} = \sum_{i=0}^{n-1}x_i 2^{i} + x_n 2^n + \sum_{j=n+1}^{w-2}x_j 2^{j}$$
which we can juggle around to read as...
$$x_n 2^n = (X - \sum_{i=0}^{n-1}x_i 2^{i}) + x_{w-1}2^{w-1} - \sum_{j=n+1}^{w-2}x_j 2^{j}$$
Note that $2^{n+1}$ divides $x_n 2^n$ if and only if $x_n = 0$. Now $2^{n+1}$ always divides $2^{w-1}$; and $2^{n+1}$ always divides $\sum_{j=n+1}^{w-2}x_j 2^{j}$. Therefore, for $0 \leq n < w-1$,
$$x_{n} = \begin{array}{lr}
0 & \text{if } {2^{n+1}} \text{ divides } {(X -\sum_{i=0}^{n-1}{x_i 2^i})}\\
1 & \text{otherwise}
\end{array}$$
gives us a recurrence: $x_0$ is $0$ iff $X$ is even, $x_1$ is $0$ iff $(X -x_0)/2$ is even, $x_2$ is $0$ iff $(X- (2x_1 + x_0))/4$ is even; and so on and so forth.