Converting a mesh to constructive solid geometry
The calculations for your objective could be considered simple geometry, although the results in terms of formulae are a bit more complex than simple, but not by much.

According to Quora, the foundation for this goal is that the cube's eight vertices will be coincidental to the sphere's surface. If one desires to print a 3D object with this form, such an object may fail the requirement of being manifold, but may not, depending on the floating point operations of the software being used.

I found a simplistic formula which provides the radius of the sphere given the length of the side of the cube.

$fn = 90;
edge = 10;
cube([edge, edge, edge], center = true);
sphere_radius = sqrt((3 * pow((edge/2), 2)));
sphere(sphere_radius);


The above code is done in OpenSCAD, resulting in this image with the sphere made transparent for clarity:



Translated into general english, it appears that one can take the edge length, divided by 2, then take the square of that result and triple it. Take the square root of that value and it becomes the radius of the sphere.

The above answer is courtesy of Math Forum and is represented verbatim as such:

        ____________________________
  D = \| (L/2)^2 + (L/2)^2 + (L/2)^2


The letter D in this case appears to be slightly misrepresented as diameter when it should be referred to as radius.

As part of this fun exercise, I also subtracted the cube from the sphere, slicing it in half for visibility, resulting in this image: