Place the beans and water in a food processor and puree until smooth, scraping down the sides as needed.
In a large skillet, heat the oil over medium heat. Add the onion and jalapeño peppers and cook, stirring often, for about 5 minutes until the onion is soft and golden. Add the cumin and garlic and cook, stirring frequently, for another 1 to 2 minutes, until you can smell the garlic and cumin.
Add the bean mixture and stir well to combine. Cook, stirring occasionally, for about 10 minutes until the beans have thickened and are smooth and creamy. Taste and add salt and pepper as needed. Stir in the cilantro, if using.
Notes
Make sure you mince your garlic very finely and chop the onions and jalapeños very finely as well. This way, they will bend into the refried beans and keep the smooth, creamy consistency.
The simple additional step of toasting the ground cumin will pay dividends in terms of adding a toasty, smoky warm flavor to your refried beans. It takes all of 1 minute, and you'll taste the difference right away.
Using the food processor to puree the beans saves you the tedious task of mashing them in the pan and creates a smoother texture. If you like your refried beans a bit chunkier, you can pulse them in the food processor and stop when they reach the desired consistency. This also helps break up the beans' skins, which can be unpleasantly tough to eat. The skins will essentially dissolve into the mashed beans. You can also mash them with a potato masher if you like.
If you want thicker refried beans, cook them for several more minutes, stirring frequently. Keep in mind that they will continue to thicken as they cool down.
If you want to start by cooking dried beans from scratch instead of using canned beans, save 1 cup of the cooking water to loosen them up. Otherwise, you will just use plain old water.