We present formulas for the nuclear and electronic spin relaxation times due to the hyperfine interaction for nanostructed systems and show that the times depend on the square of the local density of electronic states at the nuclear position. A drastic sensitivity (orders of magnitude) of the electronic and nuclear spin coherence times to small electric fields is predicted for both uniformly distributed nuclear spins and delta-doped layers of specific nuclei. This sensitivity is robust to nuclear spin diffusion.