Is there a way to convert radiation from atomic decay into energy directly, the same way we do sunlight with a solar cell?

Couldn't we have a lead box lined with these radiation to electricity converters with a small amount of radioactive material in the center, and have an energy generating device that would last for thousands or even millions of years? Imagine putting the sun in a box lined with solar cells, but on a much smaller scale.

Is there a reason this wouldn't work?