In such a simple image, not very difficult. The basic principle is that the text is made of pixels of varying opacity (fully opaque for most, but partially opaque on the edges) overlaying a background. So what we need to do is to recover that opacity, and use it when repainting with new colors. Note that this technique works to change foreground/background to any color, not just to exchange them.
So, starting with:

We use Colors>Color to alpha
to remove the background color. The remaining pixels have exactly the opacity necessary to recreate the text:

We can then paint with the same opacity by setting the alpha-lock on the layer. The alpha-lock is the checkerboard icon in the "lock" line at the top of the Layers list. When it is set, the opacity of the pixels cannot change. So we can bucket fill the whole layer with the new color, the color will only "stick" on the opaque pixels (and stick partially on the partially opaque pixels):

To fill the background, we could just add a layer filled with the new background color, move it to the bottom of the stack and merge everything, but there is a faster method: use the Behind
mode of the bucket-fill tool (the "mode" is the selector at the top of the Tool options). In that mode, paint tools only fill transparent pixels, partially fill partially opaque pixels to "complement to opacity" with the new color, and leave alone the opaque pixels. As the name implies, it is equivalent to painting on a layer behind the selected layer, so after resetting the alpha-lock (because this time we change the opacity of pixels), just bucket-fill the whole layer with the new background color:

The images at their actual size:
