The spatially resolved Kennicutt–Schmidt relation in the H i-dominated regions of spiral and dwarf irregular galaxies