Because this is a relatively basic functionality, there's not builtin way to call that command from IDAPython. You could do some Qt trickery to fake that GUI menu being clicked by the user, but that seems too much effort.
To me it seems as if the easiest and cleanest solution here is to simply call idaapi.get_many_bytes
to get the buffer of data you're interesting in dumping, and then format it however you'd like.
for example, the following code snippet will output the binary data as a hexadecimal string:
buf = idaapi.get_many_bytes(start, end)
buf.encode('hex')
Or to get a c-like array:
buf = idaapi.get_many_bytes(start, end)
buf = buf.encode('hex')
two_hex_char_seq = map(operator.add, buf[::2], buf[1::2])
c_array = "{0x" + ", 0x".join(two_hex_char_seq) + "}"
Which will give an output similar to:
{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30}