Experts said the findings were "potentially very exciting" as they could become a new treatment for the disease.
People are advised not to try this without medical advice.
In the experiments, mice were put on a modified form of the "fasting-mimicking diet".
It is like the human form of the diet when people spend five days on a low calorie, low protein, low carbohydrate but high unsaturated-fat diet.
It resembles a vegan diet with nuts and soups, but with around 800 to 1,100 calories a day.
Then they have 25 days eating what they want - so overall it mimics periods of feast and famine.
Previous research has suggested it can slow the pace of ageing.
But animal experiments showed the diet regenerated a special type of cell in the pancreas called a beta cell.
These are the cells that detect sugar in the blood and release the hormone insulin if it gets too high.
Dr Valter Longo, from the University of Southern California, said: "Our conclusion is that by pushing the mice into an extreme state and then bringing them back - by starving them and then feeding them again - the cells in the pancreas are triggered to use some kind of developmental reprogramming that rebuilds the part of the organ that's no longer functioning."
There were benefits in both type 1 and type 2 diabetes in the mouse experiments.
Type 1 is caused by the immune system destroying beta cells and type 2 is largely caused by lifestyle and the body no longer responding to insulin.
Further tests on tissue samples from people with type 1 diabetes produced similar effects.
Dr Longo said: "Medically, these findings have the potential to be very important because we've shown - at least in mouse models - that you can use diet to reverse the symptoms of diabetes.
"Scientifically, the findings are perhaps even more important because we've shown that you can use diet to reprogram cells without having to make any genetic alterations."
What's it like?
BBC reporter Peter Bowes took part in a separate trial with Dr Valter Longo.
He said: "During each five-day fasting cycle, when I ate about a quarter of the average person's diet, I lost between 2kg and 4kg (4.4-8.8lbs).
"But before the next cycle came round, 25 days of eating normally had returned me almost to my original weight.
"But not all consequences of the diet faded so quickly."
His blood pressure was lower as was a hormone called IGF-1, which is linked to some cancers.
He said: "The very small meals I was given during the five-day fast were far from gourmet cooking, but I was glad to have something to eat"
However, Dr Longo said people should not rush off and crash diet.
He told the BBC: "It boils down to do not try this at home, this is so much more sophisticated than people realise."
He said people could "get into trouble" with their health if it was done without medical guidance.
Dr Emily Burns, research communications manager at Diabetes UK, said: "This is potentially very exciting news, but we need to see if the results hold true in humans before we'll know more about what it means for people with diabetes.
"People with type-1 and type-2 diabetes would benefit immensely from treatments that can repair or regenerate insulin-producing cells in the pancreas."