Combine the fresh tomatoes, if using, chiles, and garlic in a medium saucepan, cover with water, and bring to a boil over medium-high heat. Reduce the heat to medium and simmer for 10 to 15 minutes, until the tomatoes are cooked and mushy and the chiles are soft.
Using a slotted spoon, transfer the tomatoes, chiles, and garlic to a blender. Add the canned tomatoes, if using, the onion, salt, and pepper and puree until smooth.
Heat the oil in a medium saucepan over medium heat. Pour in the tomato sauce, cover partially, and simmer for 5 to 6 minutes, stirring occasionally, until the flavors and color have deepened and the sauce has thickened slightly. Serve hot, warm, at room temperature, or chilled.
The salsa will keep, tightly covered, for up to 5 days in the refrigerator or for up to 2 months in the freezer.