It is really this simple:

C++

UImage* image = ... ;
UPaperSprite* sprite = ... ;

image->SetBrushFromAtlasInterface(sprite);

This works both in Unreal 4 and Unreal 5. The reason this works is because UPaperSprite implements the ISlateTextureAtlasInterface interface.

Hopefully this will stop someone else from searching for this function for 1+ hours like me.